package com.example.patient.controller;

import com.example.common.support.Result;
import com.example.patient.dto.req.IMOrderDetailReq;
import com.example.patient.dto.req.IMOrderListReq;
import com.example.patient.dto.req.RxOrderDetailReq;
import com.example.patient.dto.req.RxOrderListReq;
import com.example.patient.dto.resp.IMOrderDetailResp;
import com.example.patient.dto.resp.IMOrderListResp;
import com.example.patient.dto.resp.RxOrderDetailResp;
import com.example.patient.dto.resp.RxOrderListResp;
import com.example.patient.service.MyOrderService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author wxy
 * @Date 2021/1/18 13:46
 * @Version 1.0
 */
@RestController
@Api(tags = "我的订单")
@RequestMapping("/api/MyOrder")
public class MyOrderController {
    @Resource
    private MyOrderService myOrderService;

    @ApiOperation(value = "问诊订单", notes = "问诊订单")
    @PostMapping(value = "/IMOrderList")
    public Result<PageInfo<IMOrderListResp>> IMOrderList(@RequestBody IMOrderListReq req) {
        return Result.success(myOrderService.IMOrderList(req));
    }

    @ApiOperation(value = "问诊订单详情", notes = "问诊订单详情")
    @PostMapping(value = "/IMOrderDetail")
    public Result<IMOrderDetailResp> IMOrderDetail(@RequestBody IMOrderDetailReq req) {
        return Result.success(myOrderService.IMOrderDetail(req));
    }

    @ApiOperation(value = "处方订单", notes = "处方订单")
    @PostMapping(value = "/RxOrderList")
    public Result<PageInfo<RxOrderListResp>> RxOrderList(@RequestBody RxOrderListReq req) {
        return Result.success(myOrderService.RxOrderList(req));
    }

    @ApiOperation(value = "处方订单详情", notes = "处方订单详情")
    @PostMapping(value = "/RxOrderDetail")
    public Result<RxOrderDetailResp> RxOrderDetail(@RequestBody RxOrderDetailReq req) {
        return Result.success(myOrderService.RxOrderDetail(req));
    }
}
